local game = require "club.threecard.sudoku"

local M = game.ui.element()

function M:ctor(state)
    self.res = "club.threecard.sudoku/ui/common.b:puzzle_state"
    self.state = state
end

local function update(self)
    if self.state == true then
        self.solved_obj:SetActive(true)
        self.unsolved_obj:SetActive(false)
    else
        self.solved_obj:SetActive(false)
        self.unsolved_obj:SetActive(true)
    end
end

function M:on_injected(bind)
    update(self)
end

function M:set_state(state)
    if self.state == state then
        return
    end
    self.state = state
    update(self)
end

return M